optimize rendering of drop-down choices by changing how the "null" option is handled (VIV-9227) #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR significantly improves rendering performance of the choice drop-down by changing how we're displaying the "none" option.
Whereas before we used to add a special "none" option to the items list which we were then testing for in the template for each rendered item (using a switch/case), we're now instead adding a single "none" option statically in the template which is displayed/activated/disabled when needed, thus removing the need for expensive DOM checks in each rendered item.
The screenshots below are comparing the rendering performance of a drop-down with 366 visible items. The initial crest is when the user clicked on the drop-down menu. It ends when the drop-down is rendered on screen. Each test was done twice.
Legacy Implementation

Optimized Implementation
